<!DOCTYPE html>
<html>
<head>
    <title data-culture="articleManagment">草稿箱</title>

</head>
<body>
<div class="container-fluid">
    <div class="row">
        <div class="col-lg-12 col-sm-12 col-xs-12">
            <div class="widget  no-padding">
                <div class="widget-header bg-themeprimary">
                    <i class="widget-icon typcn typcn-th-list"></i>
                    <span class="widget-caption" data-culture="articleList">草稿箱</span>
                </div>
                <div class="widget-body">
                    <table id="grid-data">
                        <thead>
                        <tr>
                            <th style="text-align: center;" data-culture="receiveUserNames">收件人</th>
                            <th style="text-align: center;width:50%" data-culture="title">主题</th>
                            <th style="text-align: center;width:100px;" data-culture="operation">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr class="row-no-display">
                            <td style="text-align: center;"><a href="javascript:loadpage('/views/message/create.html?id=$id$&isZG=1&from=3',true)" >$receiveUserNames$</a></td>
                            <td style="text-align: center;"><a href="javascript:loadpage('/views/message/create.html?id=$id$&isZG=1&from=3',true)" >$title$</a></td>
                            <td class="text-left" style="text-align: center;">
                                <a rel='preview' class="btn btn-success btn-xs edit"><i
                                        class="fa  fa-key"></i><span data-culture="preview">预览</span></a>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    var articleListObj = {
        grid: {
            keys: ['keywords'],
            url: "/message/query/drafting/page",
            placeholder: '收件人、主题',
            stableparm: function () {
                return {};
            },
            events: {
                preview: function (row) {
                    var url = $.format('/views/message/create.html?id={0}&isZG=1&from=3', row.id);
                    loadpage(url,true);
                }
            },
            tools: [
                    {
                    text: '彻底删除', img: 'fa fa-times', event: function (selectItems) {
                        if (selectItems && selectItems.length > 0) {
                            bootbox.confirm('确认删除？', function () {
                                var ids = [];
                                $.each(selectItems, function (i, row) {
                                    ids.push(row.id);
                                });
                                deleteRowList(ids);
                            });
                        } else {
                            bootbox.alert('请选择待删除的记录！');
                        }
                    }
                }]
        }
    };
    function deleteRowList(ids) {
        $.request('/message/deleteMessage/ids', {ids: ids}, function () {
            bootbox.alert("删除成功!");
            articleListObj.grid.ext.refresh();
        }, function () {
            bootbox.alert("删除失败!");
        })
    }
    function init() {
        $("#grid-data").table(articleListObj.grid);
    }
    function dispose() {
        articleListObj = {};
    }
</script>
</body>
</html>